package rmi.agente;

import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.NotBoundException;
import java.net.MalformedURLException;

import rmi.RmiInterface;

public class Agente {

	public static void main( String args[] ) {
		try {
			RmiInterface m = (RmiInterface) Naming.lookup( "rmi://localhost/RmiService" );
			System.out.println( m.lerMensagem() );
			m.enviarMensagem( "Hello World!" );
			m.runAircrack();
		}
		catch( MalformedURLException e ) {
			System.out.println();
			System.out.println( "MalformedURLException: " + e.toString() );
		}
		catch( RemoteException e ) {
			System.out.println();
			System.out.println( "RemoteException: " + e.toString() );
		}
		catch( NotBoundException e ) {
			System.out.println();
			System.out.println( "NotBoundException: " + e.toString() );
		}
		catch( Exception e ) {
			System.out.println();
			System.out.println( "Exception: " + e.toString() );
		}
	}
}
